#!/bin/bash

where=$1
whereToStore=`pwd`
cd $where/ihnl/
rm -rf verilogFiles
mkdir verilogFiles
cdsFiles=`ls -la | grep -i cds | awk '{print $9}'`

for cdsFile in $cdsFiles
do
	cp $cdsFile/netlist verilogFiles/
	fileName=`cat $cdsFile/netlist | grep -i 'module ' | awk '{print $2}'`
	mv verilogFiles/netlist verilogFiles/$fileName
done


mv verilogFiles $whereToStore/$where-verilog-files-out

#cat twoToOneMux_run1/ihnl/cds0/netlist | grep -i 'module ' | awk '{print $2}'
